<?php 
//index page
//connect to mysql database
require("../storescripts/config.php");
//start session
session_start();

if (!isset($_SESSION["manager"])) {
    header("location: admin_login.php"); 
    exit();
}
//check if the manager session is in the database
$managerID = preg_replace('#[^0-9]#i', '', $_SESSION["id"]); // filter everything but numbers
$manager = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["manager"]); // filter everything but numbers and letters
$password = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["password"]); // filter everything but numbers and letters

$sql = mysql_query("SELECT * FROM admin WHERE id='$managerID' AND username='$manager' AND password='$password' LIMIT 1"); // query the person

// check if the person exists in the database
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0) { // evaluate the count
	 echo "Your login session data is not on record in the database.";
     exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Luvo Fashion - Admin Page</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />

</head>
<body>
<!-- Shell -->
<div class="shell">
  <!-- Header -->
  <div id="header">
    <h1 id="logo"><a href="index.php">Luvo Fashion</a></h1>
		<div align="right" style="padding-right:5px; padding-top:40px;"><a style="color:#ccc;" href="logout.php">Logout</a></div>
</div>
  

  <!-- End Header -->
  <!-- Main -->
  <div id="main">
  	<div style="margin-left:24px; padding-top:10px; height:430px;">
	    <h1>Hello store manager, what would you like to do today?</h1>
        <br />
        <ul style="line-height:3em; margin-left:20px;">
        	<li><a href="inventory_list.php">Manage Inventory</a></li>
        	<li><a href="account_list.php">Manage Accounts</a></li>
        </ul>
	</div>
  </div>
   
  <!-- Footer -->
   <div style="padding-top:5px;" id="footer">
    <p class="left">Admin Page</p>
    <p class="right"> &copy; 2010 Luvo Fashion.</p>
  
</div>
  <!-- End Footer -->
</div>
<!-- End Shell -->
</body>
</html>
